<template>
    <manage-public-select >
        <template slot="buttonSearch">
            <el-button style="float: right;" >查询结果</el-button>
        </template>
        <template slot="searchContent">            
            <el-form ref="form" :model="form" label-width="80px">
                <el-row>
                    <el-col :span="6">
                        <div class="grid-content bg-purple-dark">
                            <el-form-item label="所属机构">
                                <el-select v-model="form.branchId" placeholder="请选择机构" style="width:100%" clearable @focus="get_branchIdoptions">
                                    <el-option v-for="item in branchIdoptions" :key="item.value" :label="item.name"  :value="item.id"></el-option>
                                </el-select>
                            </el-form-item>
                        </div>
                    </el-col>
                    <el-col :span="6">
                        <div class="grid-content bg-purple-dark">
                            <el-form-item label="姓名">
                                <el-input v-model="form.name"></el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                    <el-col :span="6">
                        <div class="grid-content bg-purple-dark">
                            <el-form-item label="角色">
                                <el-select v-model="form.rolrId" placeholder="请选择角色" style="width:100%" clearable @focus="get_rolrIddoptions">
                                    <el-option v-for="item in rolrIddoptions" :key="item.value" :label="item.name"  :value="item.id" ></el-option>
                                </el-select>
                            </el-form-item>
                        </div>
                    </el-col>
                    <el-col :span="6">
                        <div class="grid-content bg-purple-dark">
                            <el-form-item label="状态">
                                <el-select v-model="form.enable" placeholder="请选择状态" style="width:100%">
                                    <el-option  v-for="item in enableoptions" :key="item.value" :label="item.label"  :value="item.value"></el-option>
                                </el-select>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-row>
            </el-form>
        </template>
    </manage-public-select>
</template>
<script>
import branchIdoptions from "@/mixins/requsetArrys/branchIdoptions.js"
import enableoptions from "@/mixins/constArrys/enableoptions.js"
import rolrIddoptions from "@/mixins/requsetArrys/rolrIddoptions.js"

export default {
    mixins:[branchIdoptions,enableoptions,rolrIddoptions],
    data(){
        return{
            form: {
                branchId:"",
                name: '',
                rolrId:"",
                enable:-1
            },
            rolrIddoptions:[]
        }
    },
    mounted(){
        this.handleselect();
    },
    methods:{
        handleselect(){
            this.$store.dispatch("pagination/set_currentPage4", 1);
            this.getselect();  
        },
        getselect(){
            this.form.pageSize = this.$store.getters.pageSize;
            this.form.curPage = this.$store.getters.currentPage4;
            // 点击查询发送请求
            this.$store.dispatch("system/select_system_user",this.form).then(res=>{
                const { list ,  totalCount} = res;
                // 发送数据列表
                this.$parent.getlist(list)
                // this.$emit("el_getlist",list);
                // 处理分页
                this.$store.dispatch("pagination/set_total", totalCount);
            })
        }
    }
    
}
</script>